package com.example.fruit;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class Fruit {
    private String name;
    private BigDecimal price;
    private BigDecimal weight;

    private BigDecimal discount;
    public BigDecimal getSum(){
        return this.price.multiply(this.weight).multiply(discount);
    }

    public Fruit(String name, BigDecimal price, BigDecimal weight) {
        this.name = name;
        this.price = price;
        this.weight = weight;
        this.discount = BigDecimal.valueOf(1);
    }

}
